<%@ Page language="c#" Inherits="Dimok.Aspx.Manager.Tracking.ExportFromMegasys" CodeFile="ExportFromMegasys.aspx.cs" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Export From Megasys</TITLE>
<META name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><META name="CODE_LANGUAGE" Content="C#"><META name="vs_defaultClientScript" content="JavaScript"><META name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<?XML:NAMESPACE PREFIX="WM"/>
<LINK rel="stylesheet" type="text/css" href="/CSS/navbar.css">
<LINK rel="stylesheet" type="text/css" href="/CSS/Outlook.css">
<SCRIPT src="/include/common.js"></SCRIPT>
<SCRIPT src="/include/soap.js"></SCRIPT>
<SCRIPT src="/include/XML.js"></SCRIPT>
<SCRIPT src="/include/RDS.js"></SCRIPT>
<SCRIPT src="/include/Events.js"></SCRIPT>
<SCRIPT src="/Include/DropMenu.js"></SCRIPT>
<SCRIPT src="/Manager/Common/Events.js"></SCRIPT>
<SCRIPT src="/Manager/Common/Common.js"></SCRIPT>
<SCRIPT src="/Manager/Menu/index_content_NS.js"></SCRIPT>
<STYLE>
WM\:DROPMENU { BEHAVIOR: url(/include/HTC/dropmenu_d.htc) }
.export {FONT-WEIGHT:bold;COLOR:navy;CURSOR:hand}
</STYLE>
</HEAD>
<BODY>
<TABLE datasrc="#XmlMegaLines" border="1" bordercolor="black" style="BORDER-COLLAPSE: collapse;FONT-SIZE: smaller;cursor:default"
			 oncontextmenu="return showRowMenu()"
			 rowover="1" STRIPED="0" SELECTABLE="1" class="rowover">
	<THEAD bgcolor="InactiveCaption" style="COLOR: captiontext">
		<TR valign="top"><TH nowrap>Loan ID</TH>
				<TH>XFA_ACCOUNT<BR>
						<INPUT style="width:100%;OVERFLOW-X:visible" onchange="FindInMegasys(this,'XFA_CLASSACCOUNT')">
				</TH>
				<TH>XFA_VIN<BR>
						<INPUT style="width:100%;OVERFLOW-X:visible" onchange="FindInMegasys(this,'XFA_VIN')">
				<TH>VC<BR>
						<INPUT style="width:100%;OVERFLOW-X:visible" onchange="FindInMegasys(this,'VC')">
				</TH>
				<TH>XFA_NAME<BR>
						<INPUT style="width:100%;OVERFLOW-X:visible" onchange="FindInMegasys(this,'XFA_NAME')">
				</TH>
				<TH>XFA_OPENDT<BR>
						<INPUT style="width:100%;OVERFLOW-X:visible" onchange="FindInMegasys(this,'XFA_OPENDT')">
				</TH>
				<TH>XFA_ASTATUS</TH>
				<TH>Dealer</TH>
				<TH>Comment<BR>
						<INPUT style="width:100%;OVERFLOW-X:visible" onchange="FindInMegasys(this,'Comment')">
				</TH>
				<TH nowrap>Tracker 6</TH>
				<TH>TrackerID</TH>
	</TR></THEAD>
	<TBODY>
	<TR valign="top" onmouseover="this.bgColor='InfoBackground'" onmouseout="this.bgColor=''">
		<TD align="right" onclick="showApplInfo(this)" style="CURSOR: hand"><SPAN datafld="LoanID" dataformatas="html"></SPAN></TD>
		<TD align="right"><SPAN datafld="XFA_CLASSACCOUNT"></SPAN></TD>
		<TD><SPAN datafld="XFA_VIN"></SPAN></TD>
		<TD><SPAN datafld="VC"></SPAN></TD>
		<TD nowrap><SPAN datafld="XFA_NAME"></SPAN></TD>
		<TD nowrap align="center"><SPAN datafld="XFA_OPENDT"></SPAN></TD>
		<TD align="center"><SPAN datafld="XFA_ASTATUS"></SPAN></TD>
		<TD align="center"><SPAN datafld="Dealer"></SPAN></TD>
		<TD><SPAN datafld="Comment"></SPAN></TD>
		<TD align="center"><SPAN datafld="Tracker_x0028_6_x0029_"></SPAN></TD>
		<TD align="center" onclick="showTracker(this.innerText)" style="CURSOR: hand"><SPAN datafld="TrackerID"></SPAN></TD>
	</TR>
	</TBODY>
</TABLE>
<XML runat="server" id="XmlMegaLines"></XML>
</BODY>
</HTML>
<SCRIPT language="javascript">
initWS("Common","../Common/Common.asmx");
attachToKeyDown();
function ExportFromMegasys(el){
	event.cancelBubble = true;
	if( !checkVIN(el) )return;
	var rs = rsFromElement(el);
	var msID = rs("XFA_CLASSACCOUNT").Value
	if( !confirm("Export "+msID+"?") )return;
	var ret = WS(CO(),msID);
	if( showSOAPError(ret) )return;
	rs("LoanID").Value = ret.value;
	try{el.innerHTML = ret.value;}catch(e){}
	showApplInfo(ret.value+"");
}
function FindInMegasys(el,fieldName){
	var ret = WS(CO(),fieldName,el.value);
	if( showSOAPError(ret) )return;
	if( !updateRS(XmlMegaLines.recordset,getRSFromDS(ret.value)) )
		XmlMegaLines.loadXML(ret.value);
	status = XmlMegaLines.recordset.RecordCount + " records found for ["+fieldName+" LIKE "+el.value+"]";
	el.value = "";
}
function showRowMenu(){
	var e = event.srcElement;
	var menu = new DropMenu("mnuFly");
	if( !menu.menuID )return false;
	menu.imageStyle += ";margin-top:0px;margin-bottom:0px";
	menu.add("Show Envelop","showContractTitle(ce)");
	menu.add("Copy","copyElement(ce)");
	menu.menuShow(getLeftPos(e),event.y-event.offsetY+e.offsetHeight-3);
	event.cancelBubble = true;
	return false;
}

function showContractTitle(el){
	if( !checkVIN(el) )return;
	var MsID = rsField(el,"XFA_CLASSACCOUNT");
	open("/Manager/Forms/ContractTitle.aspx?MsID="+MsID);
}
function checkVIN(el){
	var vc = rsField(el,"VC").Value;
	if( vc == "False" )return alert("VIN is incorrect!");
	return true;
}
</SCRIPT>